/*
 * Salesman.java
 *
 * Created on April 8, 2007, 3:28 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package model;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Alirio
 */
public class Salesman {
  private String id;
  private String name;
  private int topSerial;
  private int bottomSerial;
  private byte movil;
  private String password;
  private String region;
  private int lastSerial;
  private String mail;
  private String mailCoordinador;
  private List subordinates = new ArrayList();
  private List grantedActions = new ArrayList();
  
  /** Creates a new instance of Salesman */
  public Salesman() {
  }
  public Salesman(String id, String name) {
    this.id = id;
    this.name = name;
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public int getTopSerial() {
    return topSerial;
  }

  public void setTopSerial(int topSerial) {
    this.topSerial = topSerial;
  }

  public int getBottomSerial() {
    return bottomSerial;
  }

  public void setBottomSerial(int bottomSerial) {
    this.bottomSerial = bottomSerial;
  }

  public byte getMovil() {
    return movil;
  }

  public void setMovil(byte movil) {
    this.movil = movil;
  }

  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  public String getRegion() {
    return region;
  }

  public void setRegion(String region) {
    this.region = region;
  }

  public int getLastSerial() {
    return lastSerial;
  }

  public void setLastSerial(int lastSerial) {
    this.lastSerial = lastSerial;
  }
  
  public void addSubordinate(Salesman s) {
    subordinates.add(s);
  }
  
  public List getSubordinates() {
    return subordinates;
  }
  
  public void setSubordinates(List subordinates) {
    this.subordinates = subordinates;
  }

  public List getGrantedActions() {
    return grantedActions;
  }

  public void setGrantedActions(List grantedActions) {
    this.grantedActions = grantedActions;
  }
  
  public void addAction(Action a) {
    grantedActions.add(a);
  }
  
  public boolean checkAction(int a) {
    boolean result = false;
    for(int i=0;i<this.grantedActions.size();i++) {
      if (((Action)grantedActions.get(i)).getId() == a) {
        result = true;
      }
    }
    return result;
    
  }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public String getMailCoordinador() {
        return mailCoordinador;
    }

    public void setMailCoordinador(String mailCoordinador) {
        this.mailCoordinador = mailCoordinador;
    }
}
